package com.neudeu.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.neudeu.dao.ICategoryDAO;
import com.neudeu.entity.CategoryEntity;
import com.neudeu.util.ResultHandler;
import com.neudeu.util.SqlQueryUpdate;
import com.neudeu.util.SqlUtil;

public class CategoryDAOImpl implements ICategoryDAO {

	@Override
	public List<CategoryEntity> getAll() {
		String sql="select * from categray";
		return SqlQueryUpdate.query(sql,new ResultHandler<CategoryEntity>() {

			@Override
			public CategoryEntity getResult(ResultSet rs) throws SQLException {
				CategoryEntity cate=new CategoryEntity();
				cate.setCid(rs.getString("cid"));
				cate.setCname(rs.getString("cname"));
				return cate;
			}
		});
	}

}
